<?xml version="1.0"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:html="http://www.w3.org/1999/xhtml">
  <atom:id>http://bill.welliver.org/atom/smartos/Using FUSE</atom:id>
  <atom:title type="text">electronic.alchemy :: Using FUSE</atom:title>
  <atom:updated>2026-05-01T04:53:54-04:00</atom:updated>
  <atom:link href="http://bill.welliver.org/atom/smartos/Using FUSE" type="application/atom+xml"></atom:link>
  <atom:link href="http://bill.welliver.org/space/smartos/Using FUSE" type="text/html"></atom:link>
  <atom:link href="http://bill.welliver.org/rss/smartos/Using FUSE" type="application/rss+xml"></atom:link>
  <atom:generator uri="http://modules.gotpike.org/blahblah/Public.Syndication.ATOM" version="0.1">Public.Syndication.ATOM (Pike v8.0 release 702)</atom:generator>
  <atom:icon>http://bill.welliver.org/favicon.ico</atom:icon>
  <atom:logo>http://bill.welliver.org/static/images/alchemy.gif</atom:logo>
  <atom:subtitle type="xhtml"><html:div xmlns:html="http://www.w3.org/1999/xhtml"><html:p>Filesystem in Userspace (FUSE) is a mechanism that permits filesystems to be added as user-space programs, without needing to write kernel code. Support for a number of useful filesystems are available as FUSE programs(?). OI has bundled a FUSE driver and some fuse based filesystems, but most of the other illumos variants don't include this. I've put together a patch for Joyent's SmartOS that includes the necessary components for using FUSE filesytems both in the global zone and your own native zones.</html:p><html:p class="paragraph"/>
The necessary components for using FUSE filesystems are the FUSE kernel driver, libfuse and its assorted header files, and a set of programs for mounting and unmounting FUSE filesystems. You'll need a platform image built with these components, which is available here:<html:p class="paragraph"/>
<html:span class="nobr"><html:img height="9" width="8" src="/static/images/Icon-Extlink.png" alt="[external]"/><html:a href="https://bill.welliver.org/dist/smartos/builds/fuse">https://bill.welliver.org/dist/smartos/builds/fuse</html:a></html:span><html:p class="paragraph"/>
Next, you'll need a FUSE filesystem program. I'll demonstrate using sshfs. Create a new native zone (in this case, I'm using the base64-trunk image)<html:p class="paragraph"/>
In order to use FUSE in our new zone, we need to share the fuse device with the zone, and grant the zone permission to mount fuse filesystems.&#xD;
<html:div class="code"><html:pre><html:pre>&#xD;
globalzone<html:font color="brown"># zonecfg -f MYZONEUUID &lt;&lt; EOF&#xD;
</html:font>add device&#xD;
set match=/dev/fuse &#xD;
end&#xD;
exit&#xD;
EOF&#xD;
globalzone# vmadm update MYZONEUUID fs_allowed=<html:i><html:font color="darkred">"fuse"</html:font></html:i>&#xD;
globalzone<html:font color="brown"># vmadm reboot MYZONEUUID&#xD;
</html:font></html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
Now, we can build and test the sshfs FUSE filesystem in our zone:<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
myzone<html:font color="brown"># pkgin -y install build-essential glib2&#xD;
</html:font>myzone# git clone https:<html:font color="red">//github.com/alhazred/illumos-sshfs&#xD;
</html:font>myzone<html:font color="brown"># cd illumos-sshfs/sshfs-fuse/&#xD;
</html:font>myzone# vi sshfs.c # comment out the line with <html:i><html:font color="darkred">"g_thread_init()"</html:font></html:i>&#xD;
myzone# SSHFS_CFLAGS=<html:i><html:font color="darkred">"-I/usr/include/fuse -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include"</html:font></html:i> SSHFS_LIBS=<html:i><html:font color="darkred">"-lfuse -lglib-2.0 -lxnet"</html:font></html:i> ./configure&#xD;
myzone<html:font color="brown"># make&#xD;
</html:font>myzone<html:font color="brown"># mkdir /tmp/sshfs-test&#xD;
</html:font>myzone<html:font color="brown"># ./sshfs user@host:/path /tmp/sshfs-test&#xD;
</html:font>myzone<html:font color="brown"># test out your filesystem&#xD;
</html:font>myzone<html:font color="brown"># umount /tmp/sshfs-test&#xD;
</html:font></html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
We can use illumos FUSE filesystems in LX zones if the prerequisites are available. The following steps describe how to do this.<html:p class="paragraph"/>
FUSE for illumos uses pfexec to grant mount permission for non-root users when permitted. LX doesn't have pfexec, so we can put a "dummy" pfexec in the path and it will get used. We also need to make the filesystem utilities available where they're expected in the filesystem, and we can do this with a symbolic link.<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
mylxzone<html:font color="brown"># ln -s /native/usr/lib/fs /usr/lib/fs&#xD;
</html:font>mylxzone<html:font color="brown"># vi /tmp/pfexec&#xD;
</html:font>&#xD;
  <html:font color="brown">#!/bin/bash&#xD;
</html:font>  exec $*<html:p class="paragraph"/>
mylxzone<html:font color="brown"># chmod 755 /tmp/pfexec&#xD;
</html:font></html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
Now, we can try to use our native sshfs. As a quick and dirty example of this, copy the illumos native sshfs binary to our new lx zone (in our case, we'll just put it in /root). We'll also need the shared libraries, which we'll copy from /opt/local/lib to /root:<html:p class="paragraph"/>
<html:div class="code"><html:pre><html:pre>&#xD;
sshfs&#xD;
/opt/local/lib/libglib-2.0*&#xD;
/opt/local/lib/libiconv-2*&#xD;
/opt/local/lib/libpcre-2*&#xD;
/opt/local/lib/libintl*&#xD;
</html:pre></html:pre></html:div><html:p class="paragraph"/>
&#xD;
<html:div class="code"><html:pre><html:pre>&#xD;
mylxzone<html:font color="brown"># PATH=$PATH:/tmp:/native/usr/bin ./sshfs user@host:/path /tmp/sshfs-test&#xD;
</html:font></html:pre></html:pre></html:div>
</html:div></atom:subtitle>
</atom:feed>
